#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1000005;
int n, m, B; bool Vis[MAXN];
void DFS(int x, int y){
  int cnt = 0;
  if(x     > 0 && Vis[(x - 1) * m + y]) cnt++;
  if(y     > 0 && Vis[x * m + (y - 1)]) cnt++;
  if(x + 1 < n && Vis[(x + 1) * m + y]) cnt++;
  if(y + 1 < m && Vis[x * m + (y + 1)]) cnt++;
  if(cnt > 1){
    Vis[x * m + y] = 1;
    if(x     > 0 && !Vis[(x - 1) * m + y]) DFS(x - 1, y);
    if(y     > 0 && !Vis[x * m + (y - 1)]) DFS(x, y - 1);
    if(x + 1 < n && !Vis[(x + 1) * m + y]) DFS(x + 1, y);
    if(y + 1 < m && !Vis[x * m + (y + 1)]) DFS(x, y + 1);
  }
}
int solve_0(){
  while(B--){
    int x, y; cin >> x >> y;
    Vis[(x - 1) * m + (y - 1)] = 1;
  }
  for(int i = 0; i < n * m; i++) if(!Vis[i]) DFS(i / m, i % m);
  int cnt = 0;
  for(int i = 0; i < n * m; i++) cnt += Vis[i];
  cout << cnt << '\n';
  return 0;
}
vector<tuple<int, int, int, int>> A;
inline check(int l_, int r_, int d_, int u_, int l, int r, int d, int u){
  l -= 2, r += 2, d -= 2, u += 2;
  if(l_ <= r && r_ >= l && d_ <= u && u_ >= d){
    if((l_ == r || r_ == l) && (d_ >= u - 1 || u_ <= d + 1)) return 0;
    if((d_ == u || u_ == d) && (l_ >= r - 1 || r_ <= l + 1)) return 0;
    return 1;
  }
  return 0;
}
int main(){
  freopen("grid.in", "r", stdin);
  freopen("grid.out", "w", stdout);
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> n >> m >> B;
  if(n * m <= MAXN) return solve_0();
  while(B--){
    int l, d; cin >> l >> d; int r = l, u = d;
    while(true){
      bool flg = 0;
      for(int i = 0; i < (int)A.size(); i++){
        auto [l_, r_, d_, u_] = A[i];
        if(check(l_, r_, d_, u_, l, r, d, u)){
          l = min(l, l_), r = max(r, r_), d = min(d, d_), u = max(u, u_);
          A.erase(A.begin() + i), flg = 1; break;
        }
      }
      if(!flg) break;
    } A.emplace_back(l, r, d, u);
  }
  int64_t res = 0;
  for(auto [l, r, d, u]: A) res += (int64_t)(r - l + 1) * (u - d + 1);
  cout << res << '\n';
  return 0;
}
